package com.flashcash.kotlin.auth.accountKit

import com.hwangjr.rxbus.Bus

/**
 * Created by linchen on 22/03/2018.
 */
object LoginEventBus {
    val instance: Bus by lazy {
        Bus()
    }

    fun postSuccess() {
        instance.post(SuccessLoginEvent())
    }

    fun postFail(throwable: Throwable) {
        instance.post(FailLoginEvent(throwable))
    }

    fun postCancel() {
        instance.post(CancelLoginEvent())
    }
}

open class LoginEvent constructor(throwable: Throwable? = null)

class SuccessLoginEvent: LoginEvent(null)

class FailLoginEvent(throwable: Throwable): LoginEvent(throwable)

class CancelLoginEvent : LoginEvent(null)


